import React, { Component } from 'react'
import '../assets/style/indexPage_c.less';
import Img from '../components/Img_c';
import List from '../components/List_c';
import FormBtn from '../components/FormBtn_c';
import Footer from '../components/Footer_c';
import store from '../redux/reduers'
export default class IndexPage extends Component {
    state = store.getState().reducer
    
    handleClick = (url) =>{
        console.log(url);
        this.props.history.push(url)
    }
    handleClick2 = () => {
        // 退出登录 
        sessionStorage.removeItem('token')
        this.props.history.push('/')
    }
    telClick = () => {
        window.location.href = "tel:1738116065"
    }
    render() {
        console.log(this.state);
        return (
            <div className='div-index'>
                <div className="header">
                    <h3>用户中心</h3>
                    <Img src="header.jpg" />
                    <p>欢迎您 {this.state.nickname} (普通会员)</p>
                </div>
                <div className="body-index">
                    <List onClick={()=>{this.handleClick('/my')}}>个人页面</List>
                    <List onClick={()=>{this.handleClick('/focus')}}>我的关注</List>
                    <List onClick={()=>{this.handleClick('/make')}}>我的预约</List>
                    <List onClick={()=>{this.handleClick('/publish')}}>我的发布</List>
                    <List onClick={()=>{this.handleClick('/browse')}}>浏览历史</List>
                    <List onClick={()=>{this.handleClick('/pay')}}>支付明细</List>
                    <List onClick={()=>{this.handleClick('/msg')}}>消息通知</List>
                </div>
                <br />
                <FormBtn onClick={this.handleClick2}>退出登录</FormBtn>
                <Footer list={['首页', '新房', '二手', '出租', '我的']}></Footer>
                {/* 客服图标 */}
                <Img onClick={this.telClick} form="icon" src="tel.png"></Img>
            </div>
        )
    }
}
